﻿import { errorTips, setStore } from './utils';

const list = ['imageUrl', 'avatarUrl'];
export async function getAppConfig() {
    try {
        // 设置config
        const config: any = await _bridge.callNative('getAppConfig');
        console.log(config, 'config');

        // console.log(config);
        setStore('mamak-config', config);

        // 设置语言  languageType: 0, //简体中文  1 繁体 2 英文
        const lang: Record<string, any> = {
            0: 'zh_CN',
            1: 'zh_WT',
            2: 'en_US',
        };

        setStore('mamak-lang', lang[config.languageType]);

        // 获取用户信息
        const userInfo: any = await _bridge.callNative('getAppUserInfo');
        // console.log(userInfo);
        setStore('mamak-token', userInfo.token);
    } catch (error) {
        errorTips('get appInfo error');
    }
}
